//@author A0101119Y
#include "FileMgr.h"

using namespace Twentyfifth;
using namespace std;

const string FileMgr::MESSAGE_ERROR_FILE_NOT_OPEN = "File not open.";

const int FileMgr::POS_START_OF_LABEL = 0;

const string FileMgr::LABEL_SEPARATOR = "=";
const string FileMgr::LABEL_ID = "id";
const string FileMgr::LABEL_TYPE = "type";
const string FileMgr::LABEL_DESCRIPTION = "desc";
const string FileMgr::LABEL_VENUE = "venue";
const string FileMgr::LABEL_DEADLINE = "deadline";
const string FileMgr::LABEL_START = "start";
const string FileMgr::LABEL_END = "end";
const string FileMgr::LABEL_IS_DONE = "done";
const string FileMgr::LABEL_GCAL_ID = "gcal_id";
const string FileMgr::LABEL_LAST_UPDATED = "lastupdated";
const string FileMgr::LABEL_IS_DELETED = "deleted";
const string FileMgr::LABEL_FULL_DAY = "fullday";

const regex FileMgr::REGEX_TIMESTAMP("(\\d{4})-(\\d{1,2})-(\\d{1,2})T(\\d{1,2}):(\\d{1,2}):(\\d{1,2})");
const string FileMgr::VALUE_TIMESTAMP = "y-m-dTh:i:s";
const string FileMgr::VALUE_TIMESTAMP_DAY = "d";
const string FileMgr::VALUE_TIMESTAMP_MONTH = "m";
const string FileMgr::VALUE_TIMESTAMP_YEAR = "y";
const string FileMgr::VALUE_TIMESTAMP_HOUR = "h";
const string FileMgr::VALUE_TIMESTAMP_MINUTE = "i";
const string FileMgr::VALUE_TIMESTAMP_SECOND = "s";
const string FileMgr::VALUE_BOOL_FALSE = "false";
const string FileMgr::VALUE_BOOL_TRUE = "true";

void FileMgr::closeFile() {
	if (file.is_open()) {
		file.close();
	}
	return;
}